package utils;

import com.alibaba.fastjson.annotation.JSONField;
import javafx.scene.image.Image;
import lombok.Data;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
 * @author
 */
@Data
public class User implements Comparable {

    private String account  ;
    private String name;
    private String password;
    private int age;
    private String sex;
    private String address;
    private String phone;
    private String birthDay;
    private String registerDate;
    private List<String> friends;
    private List<Group> groups;

    public User(String account, String name, String password, int age, String sex, String address,  String phone, String background) {
        this.account = account;
        this.name = name;
        this.password = password;
        this.age = age;
        this.sex = sex;
        this.address = address;
        this.phone = phone;
    }

    public User() {

    }
    public User(String account) {
        this.account=account;
    }

    @Override
    public String toString() {
        return "User{" +
                "account='" + account + '\'' +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", age=" + age +
                ", sex=" + sex +
                ", address='" + address + '\'' +
                ", phone='" + phone + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        User user = (User) o;
        return Objects.equals(account, user.account);
    }

    @Override
    public int hashCode() {
        return Objects.hash(account);
    }

    @Override
    public int compareTo(Object o) {
        User user=(User)o;
        return this.getAccount().compareTo(((User) o).getAccount());
    }
}
